// page/cart/choose.js
Page({
    data: {
        isHide: 0,
        addressList: [],               // 地址列表
    },
    onLoad: function (options) {
    
    },
    setDefault: function (e) {
      // console.log(e.currentTarget.dataset.defa)//获取 data-defa
      // console.log(e.target.dataset.id)//获取 data-id
    
        var app = getApp()
        var that = this;
        var uid = wx.getStorageSync('uid');
        wx.request({
          url: app.globalData.host + '&g=App&m=Cart&a=xgchoose', //仅为示例，并非真实的接口地址
          data: { uid: uid, id: e.currentTarget.dataset.id },
          header: {
            'content-type': 'application/json'
          },
          success: function (res) {
            wx.setStorageSync('addressid', e.currentTarget.dataset.id) // 存储物流信息id
              wx.navigateBack({
              delta: 1
            })
          }
        });
      
    },
    onShow: function () {
      var app = getApp()
      var that = this;
      var uid = wx.getStorageSync('uid');
      wx.request({
        url: app.globalData.host + '&g=App&m=Cart&a=choose', //仅为示例，并非真实的接口地址
        data: { uid: uid },
        header: {
          'content-type': 'application/json'
        },
        success: function (res) {
          console.log(res.data)
          that.setData({
            isHide: 1,
            addressList: res.data.d
          })
        }
      });

    }
    
})